package org.domain.sigepac.session;

import org.domain.sigepac.Utils;
import org.domain.sigepac.Entity.GrupoEvasao;
import org.domain.sigepac.home.EntityHomeSupport;
import org.domain.sigepac.repository.RepositorioGrupoEvasao;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Begin;
import org.jboss.seam.annotations.End;
import org.jboss.seam.annotations.FlushModeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.international.StatusMessages;

@Name("grupoEvasaoHome")
@Scope(ScopeType.CONVERSATION)
public class GrupoEvasaoHome extends EntityHomeSupport<GrupoEvasao> {

	private static final long serialVersionUID = -3621274260387477469L;

	@In
	private StatusMessages statusMessages;

	@In
	private RepositorioGrupoEvasao repositorioGrupoEvasao;


	public GrupoEvasaoHome() {
		// TODO Auto-generated constructor stub
	}


	@Override
	protected GrupoEvasao createInstance() {
		GrupoEvasao grupoPsicogenese=new GrupoEvasao();
		return grupoPsicogenese;
	}



	@End
	public void salvar(){

		//persist();
		repositorioGrupoEvasao.inserir(getInstance());
		Utils.entityManagerFlush();
		createdMessage();

	}

	@Begin(flushMode=FlushModeType.MANUAL,join=true)
	public void setIdGrupoEvasao(Integer id) {
	    setId(id);
	 }

	public Integer getIdGrupoEvasao() {
	    return (Integer) getId();
	  }

	public boolean isWired(){
		return getInstance().getId()!=null;
	}
}
